//
//  FoodTableVC.m
//  YQYHOUSE
//
//  Created by 倪勇勤 on 15/12/14.
//  Copyright © 2015年 niyonqin. All rights reserved.
//

#import "FoodTableVC.h"
#import "FoodCell.h"
#import "PlaySpecialCell.h"
#import "lifeSpecialCell.h"
#import "PlayFirstCell.h"
#import "lifeFirstCell.h"
@interface FoodTableVC ()

@end

@implementation FoodTableVC

static NSString *ID = @"simpleCell";
static NSString *specialPlayID = @"specialPlayCell";
static NSString *specialLifeID = @"specialLifeCell";
static NSString *firstPlayID = @"firstPlayCell";
static NSString *firstLifeID = @"firstLifeCell";


- (void)viewDidLoad {
    [super viewDidLoad];
    //设置tableV
    [self setupTableView];


}

-(void)setupTableView
{
    self.tableView.rowHeight = 150;
    //进行cell的标识注册
    // < 1. 普通cell的
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([FoodCell class]) bundle:nil]  forCellReuseIdentifier:ID];
    // < 2. 玩乐特殊cell的注册
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([PlaySpecialCell class]) bundle:nil] forCellReuseIdentifier:specialPlayID ];
    // < 3. 生活学院特殊cell的注册
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([lifeSpecialCell class]) bundle:nil] forCellReuseIdentifier:specialLifeID ];
    // < 4. 玩乐第一个cell注册
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([PlayFirstCell class]) bundle:nil] forCellReuseIdentifier:firstPlayID];
    
    // < 5. 生活学院第一个cell注册
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([lifeFirstCell class]) bundle:nil] forCellReuseIdentifier:firstLifeID];
    
    //将分隔线隐藏
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

}
-(BOOL)prefersStatusBarHidden
{


    return YES;
}



#pragma mark -------------------------
#pragma mark -tableView的协议

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    
    return 10;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    FoodCell *foodCell = [tableView dequeueReusableCellWithIdentifier:ID];
//    FoodSpecialCell *specialCell = [tableView dequeueReusableCellWithIdentifier:specialID];
    
    if (indexPath.row == 0) {
        PlayFirstCell *firstPlayCell = [tableView dequeueReusableCellWithIdentifier:firstPlayID];
        
        return firstPlayCell;
    }
    
    if (indexPath.row == 1) {
        
        lifeFirstCell *lifeFirstCell = [tableView dequeueReusableCellWithIdentifier:firstLifeID];
        
        return lifeFirstCell;
    }
    
    if (indexPath.row == 2) {
     PlaySpecialCell *specialPlayCell = [tableView dequeueReusableCellWithIdentifier:specialPlayID];
        return specialPlayCell;
    }
    
    if (indexPath.row == 3) {
        lifeSpecialCell *specialLifeCell = [tableView dequeueReusableCellWithIdentifier:specialLifeID];
        return specialLifeCell;
    }
    return foodCell;
    
}
@end
